import Vue from "vue";
import VueRouter from "vue-router";
const originalPush = VueRouter.prototype.push
   VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}

// 页面引入
import home from '../components/dhzn_home.vue'
import shops from "../components/dhzn_shops.vue"
import classifysort from "../components/dhzn_classifysort.vue";
import farmer from "../components/dhzn_farmer.vue"
import logistics from "../components/dhzn_logistics.vue"
import users from "../components/dhzn_users.vue"
import service from "../components/dhzn_service.vue"
import goods from "../components/dhzn_goods"
    // 子路由、
    import gdactivity from '../components/dhzn_goods/dhzn_goodsactivity.vue'  	//商品活动
    import gdcoupon from '../components/dhzn_goods/dhzn_goodscoupon.vue'		//商品优惠券
    import gddetails from '../components/dhzn_goods/dhzn_goodsdetails.vue'   	//商品详情
    import gdsevalu from '../components/dhzn_goods/dhzn_goodsevaluate.vue'      //商品评价
	import gdsevimg from '../components/dhzn_goods/dhzn_goodsevimg.vue'		//评价图片
	import gdsmaterial from '../components/dhzn_goods/dhzn_goodsmaterial.vue'  //轮播图
	import gdserve from '../components/dhzn_goods/dhzn_goodsserve.vue'			//商品服务
	import gdsize from '../components/dhzn_goods/dhzn_goodssize.vue'            //商品规格
    // import son from "../components/son.vue"
import activity from '../components/dhzn_activity.vue'
import slideshow from '../components/dhzn_slideshow.vue'
import goodscoupon from '../components/dhzn_goodscoupon.vue'
// import goodsdetails from '../components/dhzn_goodsdetails.vue'
    // 子路由

import role from '../components/dhzn_role.vue'
    import rolestat from '../components/dhzn_role/dhzn_rolestat.vue'            //总数据
    import rolelist from '../components/dhzn_role/dhzn_rolelist.vue'            //合伙人
    import rolejun from '../components/dhzn_role/dhzn_rolejunior.vue'
    import rolefroli from '../components/dhzn_role/dhzn_rolesfrolirm.vue'
    import roledea from '../components/dhzn_role/dhzn_roledealer.vue'
    import rolesh from '../components/dhzn_role/dhzn_roleshop.vue'
    import roleboss from '../components/dhzn_role/dhzn_roleboss.vue'
    import rolecomman from '../components/dhzn_role/dhzn_rolecommonman.vue'
    import rolentman from '../components/dhzn_role/dhzn_roleenterpriseman.vue'

import store from '../components/dhzn_store.vue'                      //店铺（非商家，上面有个商家）
import shopvip from '../components/dhzn_shopvip.vue'                  //店铺会员管理
    import image from '../components/dhzn_homepage/dhzn_image.vue'
    // import active from '../components/dhzn_homepage/dhzn_active.vue'
    import acgoods from '../components/dhzn_homepage/dhzn_acgoods.vue'

import inhome from '../components/dhzn_indent/dhzn_inhome.vue'      //订单
import ingoods from '../components/dhzn_indent/dhzn_ingoods.vue'    //订单商品
import inexpress from '../components/dhzn_indent/dhzn_inexpress.vue' //物流


import gac from '../components/dhzn_goodscoupon.vue'
// 挂在路由，因为这个是vue的核心专用组件，实用的install方法调用，必须用Vue.use挂载
Vue.use(VueRouter);

// 路由注册
const routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        name: '首页',
        // component: home
        //     component: resolve => require(["../components/dhzn_home.vue"], resolve)
        component: resolve => require(["../components/dhzn_home.vue"], resolve)
    },{
      path: '/shops',
      name: '商店',
    //     component: resolve => require(["../components/dhzn_shops.vue"], resolve)
    component: resolve => require(["../components/dhzn_shops.vue"], resolve)    
    },{
        path: '/classifysort',
        name: 'classifysort',
        // component: classifysort
        component: resolve => require(["../components/dhzn_classifysort.vue"], resolve)
    },{
      path: '/farmer',
      name: 'farmer',
    // component: farmer
    component: resolve => require(["../components/dhzn_farmer.vue"], resolve)    
    },{
        path: '/logistics',
        name: 'logistics',
        // component: logistics
        component: resolve => require(["../components/dhzn_logistics.vue"], resolve)
    },{
        path: '/users',
        name: 'users',
        // component: users
        component: resolve => require(["../components/dhzn_users.vue"], resolve)
    },{
        path: '/service',
        name: 'service',
        // component: service
        component: resolve => require(["../components/dhzn_service.vue"], resolve)
    },{
        path: '/goods',
        name: 'goods',
        // component: goods,
        component: resolve => require(["../components/dhzn_goods.vue"], resolve),
        children: [
            {
                path: 'gdactivity/:aid',
                name: 'gdactivity',
                // component: gdactivity
                component: resolve => require(["../components/dhzn_goods/dhzn_goodsactivity.vue"], resolve)
            },{
                path: 'gdcoupon/:aid',
                name: 'gdcoupon',
                // component: gdcoupon
                component: resolve => require(["../components/dhzn_goods/dhzn_goodscoupon.vue"], resolve)
            },{
                path: 'gddetails/:aid',
                name: 'gddetails',
                // component: gddetails
                component: resolve => require(["../components/dhzn_goods/dhzn_goodsdetails.vue"], resolve)
            },{
                path: 'gdsize/:aid',
                name: 'gdsize',
                // component: gdsize
                component: resolve => require(["../components/dhzn_goods/dhzn_goodssize.vue"], resolve)
            },{
                path: 'gdsevalu/:aid',
                name: 'gdsevalu',
                // component: gdsevalu
                component: resolve => require(["../components/dhzn_goods/dhzn_goodsevaluate.vue"], resolve)
            },{
                path: 'gdsevimg/:aid',
                name: 'gdsevimg',
                // component: gdsevimg
                component: resolve => require(["../components/dhzn_goods/dhzn_goodsevimg.vue"], resolve)
            },{
                path: 'gdsmaterial/:aid',
                name: 'gdsmaterial',
                // component: gdsmaterial
                component: resolve => require(["../components/dhzn_goods/dhzn_goodsmaterial.vue"], resolve)
            },{
                path: 'gdserve/:aid',
                name: 'gdserve',
                // component: gdserve 
               component: resolve => require(["../components/dhzn_goods/dhzn_goodsserve.vue"], resolve)
            }
        ]
    },{
        path: '/activity',
        name: 'activity',
        // component: activity,
        component: resolve => require(["../components/dhzn_activity.vue"], resolve)
    },{
        path: '/slideshow',
        name: 'slideshow',
        // component: slideshow
        component: resolve => require(["../components/dhzn_slideshow.vue"], resolve)
    },{
        path: '/goodscoupon',
        name: 'goodscoupon',
        // component: goodscoupon
        component: resolve => require(["../components/dhzn_goodscoupon.vue"], resolve)
    },{
        path: '/role',
        name: 'role',
        redirect: '/role/rolestat',
        // component: role,
        component: resolve => require(["../components/dhzn_role.vue"], resolve),
        children: [
            {
                path: 'rolestat',
                name: 'rolestat',
                // component: rolestat
                component: resolve => require(["../components/dhzn_role/dhzn_rolestat.vue"], resolve)
            },{
                path: 'rolelist',
                name: 'rolelist',
                // component: rolelist
                component: resolve => require(["../components/dhzn_role/dhzn_rolelist.vue"], resolve)
            },{
                path: 'rolefroli',
                name: 'rolefroli',
                // component: rolefroli
                component: resolve => require(["../components/dhzn_role/dhzn_rolesfrolirm.vue"], resolve)
            },{
                path: 'rolejun',
                name: 'rolejun',
                // component: rolejun
                component: resolve => require(["../components/dhzn_role/dhzn_rolejunior.vue"], resolve)
            },{
                path: 'roledea',
                name: 'roledea',
                // component: roledea
                component: resolve => require(["../components/dhzn_role/dhzn_roledealer.vue"], resolve)
            },{
                path: 'rolesh',
                name: 'rolesh',
                // component: rolesh
                component: resolve => require(["../components/dhzn_role/dhzn_roleshop.vue"], resolve)
            },{
                path: 'roleboss',
                name: 'roleboss',
                // component: roleboss
                component: resolve => require(["../components/dhzn_role/dhzn_roleboss.vue"], resolve)
            },{
                path: 'rolecomman',
                name: 'rolecomman',
                // component: rolecomman
                component: resolve => require(["../components/dhzn_role/dhzn_rolecommonman.vue"], resolve)
            },{
                path: 'rolentman',
                name: 'rolentman',
                // component: rolentman
              component: resolve => require(["../components/dhzn_role/dhzn_roleenterpriseman.vue"], resolve)
            }
        ]
    },{
        path: '/store',
        name: 'store',
        // component: store
        component: resolve => require(["../components/dhzn_store.vue"], resolve)
    },{
        path: '/shopvip',
        name: 'shopvip',
        // component: shopvip
        component: resolve => require(["../components/dhzn_shopvip.vue"], resolve)
    },{
        path: '/homepage/image',
        name: 'image',
        // component: image,
        component: resolve => require(["../components/dhzn_homepage/dhzn_image.vue"], resolve)
    },{
        path: '/homepage/active',
        name: 'active',
        // component: active,
        component: resolve => require(["../components/dhzn_homepage/dhzn_active.vue"], resolve)
    },{
        path: '/homepage/acgoods',
        name: 'acgoods',
        // component: acgoods,
        component: resolve => require(["../components/dhzn_homepage/dhzn_acgoods.vue"], resolve)
    },{
        path: '/indent/inhome',
        name: '订单',
        // component: inhome,
        component: resolve => require(["../components/dhzn_indent/dhzn_inhome.vue"], resolve)
    },{
        path: '/indent/ingoods/:aid',
        name: '订单商品',
        // component: ingoods  
        component: resolve => require(["../components/dhzn_indent/dhzn_ingoods.vue"], resolve)
    },{
        path: '/indent/inexpress',
        name: '物流',
        // component: inexpress  
       component: resolve => require(["../components/dhzn_indent/dhzn_inexpress.vue"], resolve)
    },

    // {
    //     path: '/gac',
    //     name: 'gac',
    //     // component: gac
    //     component: resolve => require(["../components/dhzn_shops.vue"], resolve)
    // }
	{
		path: '/newfile',
		name: '物流',
		 // component: inexpress  
		component: resolve => require(["../components/new_file.vue"], resolve)
	}
  
]


const router = new VueRouter({
    // mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router